package com.ruoyi.web.enums;

import java.util.Objects;

/**
 * @desc  设备类型
 * @author fwx 2024/2/6 15:26
 **/
public enum DeviceTypeEnum {

    FL2("fl2","虫情设备"),
    FL5("fl5","气象设备"),
    FL1("fl1","墒情设备"),
    FL4("fl4","苗情设备"),
    FL3("fl3","病情设备"),
    KILL("killInsect","杀虫灯设备");

    private final String code;
    private final String describe;

    DeviceTypeEnum(String code, String describe){
        this.code = code;
        this.describe = describe;
    }

    public String getValue() {
        return this.code;
    }

    public String getDescription() {
        return this.describe;
    }


    //根据code查询枚举
    public static DeviceTypeEnum getByCode(String code){
        DeviceTypeEnum[] enums = DeviceTypeEnum.values();
        for( DeviceTypeEnum codeEnum : enums){
            if(Objects.equals(code,codeEnum.getValue())){
                return codeEnum;
            }
        }
        return null;
    }

}
